package com.yan.thread;

/**
 * @author taoge
 * @Date 2024/8/7 11:49
 * @Description 匿名内部类
 */
public class ThreadDemo3 {
    public static void main(String[] args) {
        Thread t1 = new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 10; i++) {
                    System.out.println(Thread.currentThread().getName() + "---" + i);
                }
            }
        }, "线程A");
        t1.start();
        Thread t2 = new Thread(() -> {
            for (int i = 0; i < 10; i++) {
                System.out.println(Thread.currentThread().getName() + "---" + i);
            }
        }, "线程B");
        t2.start();
    }
}
